package com.zscg.sequence.data;

import java.io.Serializable;
import java.security.MessageDigest;

public class User implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 553003166960879716L;
	private int userId;// 用户ID
	private String userName;// 用户名
	private String userPass;// 密码
	private int userLevel;// 等级
	private int userCash;// 龙蛋积分
	private String userPhoto;// 照片地址
	private int userState = 0;// 用户状态
	private float userLoginPosX; // 用户登陆时所在经度
	private float userLoginPosY;// 用户登录时所在纬度
	private String userEmail;// 用户邮箱
	private String userTel;// 手机号码
	private int userAge;// 年龄
	private String userBirth;// 生日
	private String userSign;// 签名
	private int userSex;// 性别 0：男 1：女 2:保密
	private String userNickName;// 昵称
	private long created;// 注册时间
	private String userLastLoginIp;// ip地址
	private long userLastLoginTime;// 最后一次登录时间
	private boolean userIsOnline;// 是否在线
	private int checkFlag;// 是否禁用 1：禁用
	private int searchFlag;// 搜索设置
	private String userProvince;// 所在省
	private String userArea;// 所在市
	private boolean isRoomOrder;//是否是房主

	public User() {

	}

	public int getUserId() {
		return userId;
	}

	public void setUserId(int userId) {
		this.userId = userId;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getUserPass() {
		return userPass;
	}

	public static String MD5(String str) {
		MessageDigest md5 = null;
		try {
			md5 = MessageDigest.getInstance("MD5");
		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
		char[] charArray = str.toCharArray();
		byte[] byteArray = new byte[charArray.length];
		for (int i = 0; i < charArray.length; i++) {
			byteArray[i] = (byte) charArray[i];
		}
		byte[] md5Bytes = md5.digest(byteArray);
		StringBuffer hexValue = new StringBuffer();
		for (int i = 0; i < md5Bytes.length; i++) {
			int val = ((int) md5Bytes[i]) & 0xff;
			if (val < 16) {
				hexValue.append("0");
			}
			hexValue.append(Integer.toHexString(val));
		}
		return hexValue.toString();
	}

	public void setUserPass(String userPass) {

		this.userPass = MD5(userPass);
	}

	public int getUserLevel() {
		return userLevel;
	}

	public void setUserLevel(int userLevel) {
		this.userLevel = userLevel;
	}

	public int getUserCash() {
		return userCash;
	}

	public void setUserCash(int userCash) {
		this.userCash = userCash;
	}

	public String getUserPhoto() {
		return userPhoto;
	}

	public void setUserPhoto(String userPhoto) {
		this.userPhoto = userPhoto;
	}

	public int getUserState() {
		return userState;
	}

	public void setUserState(int userState) {
		this.userState = userState;
	}

	public float getUserLoginPosX() {
		return userLoginPosX;
	}

	public void setUserLoginPosX(float userLoginPosX) {
		this.userLoginPosX = userLoginPosX;
	}

	public float getUserLoginPosY() {
		return userLoginPosY;
	}

	public void setUserLoginPosY(float userLoginPosY) {
		this.userLoginPosY = userLoginPosY;
	}

	public String getUserEmail() {
		return userEmail;
	}

	public void setUserEmail(String userEmail) {
		this.userEmail = userEmail;
	}

	public String getUserTel() {
		return userTel;
	}

	public void setUserTel(String userTel) {
		this.userTel = userTel;
	}

	public int getUserAge() {
		return userAge;
	}

	public void setUserAge(int userAge) {
		this.userAge = userAge;
	}

	public String getUserBirth() {
		return userBirth;
	}

	public void setUserBirth(String userBirth) {
		this.userBirth = userBirth;
	}

	public String getUserSign() {
		return userSign;
	}

	public void setUserSign(String userSign) {
		this.userSign = userSign;
	}

	public int getUserSex() {
		return userSex;
	}

	public void setUserSex(int userSex) {
		this.userSex = userSex;
	}

	public String getUserNickName() {
		return userNickName;
	}

	public void setUserNickName(String userNickName) {
		this.userNickName = userNickName;
	}

	public long getCreated() {
		return created;
	}

	public void setCreated(long created) {
		this.created = created;
	}

	public String getUserLastLoginIp() {
		return userLastLoginIp;
	}

	public void setUserLastLoginIp(String userLastLoginIp) {
		this.userLastLoginIp = userLastLoginIp;
	}

	public long getUserLastLoginTime() {
		return userLastLoginTime;
	}

	public void setUserLastLoginTime(long userLastLoginTime) {
		this.userLastLoginTime = userLastLoginTime;
	}

	public boolean isUserIsOnline() {
		return userIsOnline;
	}

	public void setUserIsOnline(boolean userIsOnline) {
		this.userIsOnline = userIsOnline;
	}

	public int getCheckFlag() {
		return checkFlag;
	}

	public void setCheckFlag(int checkFlag) {
		this.checkFlag = checkFlag;
	}

	public int getSearchFlag() {
		return searchFlag;
	}

	public void setSearchFlag(int searchFlag) {
		this.searchFlag = searchFlag;
	}

	public String getUserProvince() {
		return userProvince;
	}

	public void setUserProvince(String userProvince) {
		this.userProvince = userProvince;
	}

	public String getUserArea() {
		return userArea;
	}

	public void setUserArea(String userArea) {
		this.userArea = userArea;
	}

	public boolean isRoomOrder() {
		return isRoomOrder;
	}

	public void setRoomOrder(boolean isRoomOrder) {
		this.isRoomOrder = isRoomOrder;
	}
	


}
